//
// Created by chizuru on 2025/9/2.
//
#pragma once
#include "ProtocolResult.h"
#include "IProtocolCodec.h"
#include <vector>
#include <cstdint>
#include <string>

class CLBProtocolCodec : public IProtocolCodec{
public:
    // todo commandid应当是0x52/0x57,地址与值应当在args中
    std::vector<uint8_t> buildWriteFrame(const CommandId &addr, const CodecArgs &args) const override;

    std::vector<uint8_t> buildReadFrame(const CommandId &addr, const CodecArgs &args) const override;

    ProtocolResult parseWriteResponse(std::span<const uint8_t> resp, const CommandId &commandId, const CodecArgs& args = {}) const override;

    ProtocolResult parseReadResponse(std::span<const uint8_t> resp, const CommandId &commandId, const CodecArgs& args = {}) const override;

    static std::string parseUint32ToString(uint32_t value);
};

